package com.gpy.hospital.cms.controller;

import com.gpy.hospital.cms.service.IFileService;
import com.gpy.hospital.common.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

/**
 * @Author
 * @Date 2020/2/8 22:51
 * @Desc
 **/
@Controller
public class FileController {

    @Autowired
    private IFileService fileService;

    /**
     * 上传图片
     * @param file
     * @return
     */
    @PostMapping("/file/upload")
    @ResponseBody
    public ServerResponse fileUpload(MultipartFile file) {
        return fileService.upload(file);
    }



    @PostMapping("/file/uploads")
    @ResponseBody
    public HashMap fileUploads(MultipartFile file) {
        return fileService.uploads(file);
    }
}
